<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:core="http://www.contact.core.com/contacts/core/ui"
      xmlns:atria="http://www.atria.cz/common/jsf"
        >


<!--@elvariable id="searchResult" type="rs.contacts.core.core.searcher.entity.FriendResult"-->
<ui:component>
    <style type="text/css">
        .a1 A:link {
            text-decoration: none;
            color: #20205e;
        }

        .a1 A:visited {
            text-decoration: none;
            color: #20205e;
        }

        .a1 A:active {
            text-decoration: none;
            color: yellow;
        }

        .a1 A:hover {
            text-decoration: none;
            background: #20205e;
            font-style: italic;
            color: white;
        }

        .profileLink A:link {
            text-decoration: none;
            color: #20205e;
        }

        .profileLink A:visited {
            text-decoration: none;
            color: #20205e;
        }

        .profileLink A:active {
            text-decoration: none; /*color: yellow;*/
        }

        .profileLink A:hover {
            text-decoration: underline;
        }

        table.noborder td {
            border: 0px;
        }
    </style>
    <a4j:outputPanel layout="block" style="width:100%" styleClass="topDownMargin">
        <rich:panel style="overflow:auto; width:100%; border:none" bodyClass="rich-laguna-panel-no-header">
            <a4j:outputPanel layout="block">

                <a4j:outputPanel layout="block" style="float:left;">
                    <a4j:outputPanel layout="block" style="float:left;">
                        <!--<h:graphicImage value="./style/images/noImage.PNG" style="resize:both; width: 100px;"/>-->
                        <core:pictureForView style="resize:both; width: 100px;"
                                             pictureKey="photoprofile_#{searchResult.id}"
                                             informationId="#{searchResult.id}"/>
                    </a4j:outputPanel>
                    <a4j:outputPanel styleClass="profileLink" layout="block" style="float:right;">
                        <h:panelGrid columns="2" styleClass="noborder">
                            <h:outputLabel value="#{resources.nameLabel}:" style="color:gray;"/>

                            <a4j:commandLink value="#{searchResult.firstName} #{searchResult.lastName}"
                                             action="#{accountBean.friendProfileFromA4j}"
                                             style="font-size:13px; font-weight:200;">
                                <f:setPropertyActionListener value="#{searchResult}"
                                                             target="#{accountBean.friendResult}"/>
                            </a4j:commandLink>

                            <h:outputLabel value=" #{resources.emailLabel}:" style="color:gray"/>
                            <h:outputLabel value="#{searchResult.email}"/>

                            <h:outputLabel rendered="#{searchResult.sizeMutalFriends != 0 and
                            accountSessionBean.accountInformationId != searchResult.id                            
                            }" value="#{resources.friendsLabel}:" style="color:gray"/>

                            <a4j:outputPanel rendered="#{accountSessionBean.accountInformationId != searchResult.id }">
                                <a4j:commandLink rendered="#{searchResult.sizeMutalFriends != 0}"
                                                 value="#{searchResult.sizeMutalFriends} #{resources.mutualFriendsLabel}"
                                                 action="#{viewFriendBean.prepareForViewMutualFriends}"
                                                 reRender="someoneFriendViewPanel"
                                                 oncomplete="Richfaces.showModalPanel('someoneFriendViewPanel');"
                                                 limitToList="true">

                                    <f:setPropertyActionListener value="#{searchResult}"
                                                                 target="#{viewFriendBean.forProccess}"/>
                                </a4j:commandLink>
                            </a4j:outputPanel>
                        </h:panelGrid>

                    </a4j:outputPanel>
                </a4j:outputPanel>
                <a4j:outputPanel styleClass="a1" layout="block" style="float:right;">

                    <a4j:outputPanel layout="block" style="float:right;">
                        <h:panelGrid styleClass="noborder" columns="1">
                            <h:panelGroup rendered="#{searchResult.requestStatus eq null and
                            accountSessionBean.accountInformationId != searchResult.id}">
                                <a4j:commandLink value="#{resources.sendRequestLabel}"
                                                 action="#{newFriendBean.prepareToSendRequest}"
                                                 reRender="addNewFriendRequestModalPanel"
                                                 oncomplete="if(data)Richfaces.showModalPanel('addNewFriendRequestModalPanel');"
                                                 limitToList="true"
                                                 data="#{newFriendBean.canAdd}"
                                        >
                                    <f:setPropertyActionListener value="#{searchResult}"
                                                                 target="#{newFriendBean.forProccess}"/>
                                </a4j:commandLink>
                                <!--<a4j:commandLink value="Send Request" action="#{searchBean.sendRequest}">-->
                                <!--<f:setPropertyActionListener value="#{searchResult}"-->
                                <!--target="#{searchBean.forProcess}"/>-->
                                <!--</a4j:commandLink>-->

                            </h:panelGroup>

                            <h:panelGroup rendered="#{accountSessionBean.accountInformationId == searchResult.id}">
                                <a4j:commandLink value="#{resources.viewProfileLabel}"
                                                 action="#{accountBean.friendProfileFromA4j}">
                                    <f:setPropertyActionListener value="#{searchResult}"
                                                                 target="#{accountBean.friendResult}"/>
                                </a4j:commandLink>

                            </h:panelGroup>
                            <h:panelGroup rendered="#{searchResult.requestStatus eq 'REQUEST'}">
                                <h:outputLabel value="#{resources.waitingApprovalText}"/>
                            </h:panelGroup>

                            <h:panelGroup rendered="#{searchResult.requestStatus eq 'CONFIRM'}">
                                <a4j:commandLink value="#{resources.confirmRequestLabel}"
                                                 action="#{newFriendBean.confirmRequest}"
                                                 reRender="searchResultPanel"
                                        >

                                    <f:setPropertyActionListener value="#{searchResult.id}"
                                                                 target="#{newFriendBean.informationIdForProccess}"/>
                                </a4j:commandLink>
                            </h:panelGroup>

                            <rich:separator rendered="#{searchResult.requestStatus eq 'REQUEST' or
                             searchResult.requestStatus eq 'CONFIRM' or
                            searchResult.requestStatus eq null}" height="2" width="100%"/>
                            <a4j:commandLink value="#{resources.sendAMessageLabel}"
                                             reRender="sendMessageModalPanel"
                                             oncomplete="Richfaces.showModalPanel('sendMessageModalPanel'); #{rich:element('messageReceiver')}.value='#{searchResult.email}';"
                                             limitToList="true">
                            </a4j:commandLink>
                            <rich:separator height="2" width="100%"/>
                            <a4j:commandLink value="#{resources.viewFriendsLabel}"
                                             action="#{viewFriendBean.prepareForViewAllFriends}"
                                             reRender="someoneFriendViewPanel"
                                             oncomplete="Richfaces.showModalPanel('someoneFriendViewPanel');"
                                             limitToList="true"
                                    >
                                <f:setPropertyActionListener value="#{searchResult}"
                                                             target="#{viewFriendBean.forProccess}"/>
                            </a4j:commandLink>
                            
                        </h:panelGrid>
                    </a4j:outputPanel>
                </a4j:outputPanel>
            </a4j:outputPanel>

        </rich:panel>
    </a4j:outputPanel>


</ui:component>


</html>